/**
 * 
 */
package dms.util;

import javax.servlet.http.HttpServletRequest;

/**
 * 解析request中的start和count参数，失败则返回0,50
 * @author 李健
 *
 */
public class PageUtil {
	public static int START = 0;
	public static int COUNT = 50;
	
	public static int[] parsePageParameter(HttpServletRequest request) {
		int start = 0;
		int count = 0;
		
		try {
			start = Integer.valueOf(request.getParameter("start"));
			count = Integer.valueOf(request.getParameter("count"));
		} catch (NumberFormatException e) {			
			start = START;
			count = COUNT;
		}
		
		return new int[]{start, count};
	}
}
